<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>v-bind指令的用法</title>
		<!-- 引入vue的js文件 -->
		<script src="js/vue.js"></script>
		<style>
			.active{
				width: 80px;
				height: 40px;
				background-color: yellow;
				color: red;
			}
				
		</style>
	</head>
	<body>
		<div id="app">
			<button @click="changeImg()">切换元素显示隐藏</button>
			<br />
			<img v-bind:src="url" v-if="isShow"/>	
			<button :class="isActive?'active':''">ok</button>		
			<button @click="changeClass()">切换class属性的值</button>
		</div>		
	</body>
	<script>
	var app=new Vue({
		el:"#app",
		data:{
			isShow:false,
			url:"img/bg1.jpg",
			isActive:true
			
		},
		methods:{
			changeImg:function(){
				this.isShow=!this.isShow
			},
			changeClass:function(){
				this.isActive=!this.isActive
			}
			
		}
	})
	
	</script>
</html>
